package com.example.demo.zcy;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

@Service
public class PersonService {

    @Resource
    private PersonRepository repository;


    @Transactional
    public void save(Person person){
        repository.save(person);
    }

    @Transactional
    public void delete(int id){
        repository.deleteById(id);
    }

    public Iterable<Person> getAll(){
        return repository.findAll();
    }


}
